package com.blb.exam.dao.impl;

import com.blb.exam.common.entity.User;
import com.blb.exam.common.util.DBUtils;
import com.blb.exam.dao.UserDAO;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class UserDAOImpl implements UserDAO {

    @Override
    public User selectByNameAndPassword(String username, String password) {
        List<User> users = DBUtils.executeQuery(User.class, "select * from t_user where username=? and password=?", username, password);
        if(users != null && !users.isEmpty()){
            return users.get(0);
        }
        return null;
    }
}
